ifneq ($(KERNELRELEASE),)
    # start
    obj-m := dbl/comm_algorithm/
    obj-m += dbl/dev_identity/
    obj-m += dbl/runenv_config/
    obj-m += dms/smf/
    obj-m += libc_sec/
    obj-m += pcie_host/
    obj-m += pcievnic_host/
    obj-m += hdc_host/
    obj-m += soft_fault/
    obj-m += drv_davinci_intf_host/
    obj-m += dms/
    obj-m += event_sched/host/
    obj-m += svmdrv/pmaster/
    obj-m += queue/host/
    obj-m += dp_proc_mng/pmaster/
    obj-m += dms/dtm/
    obj-m += dbl/uda/
    obj-m += dbl/dev_urd/
    obj-m += dms/mng/
    obj-m += dbl/soc_resmng/
    obj-m += dvpp_cmdlist/
    obj-m += ts_agent/
    obj-m += dbl/soc_platform/
    obj-m += rms/trs_drv/chan/
    obj-m += rms/trs_drv/trs_core/
    obj-m += rms/trs_drv/id_allocator/
    obj-m += rms/trs_drv/lba/near/sia/adapt/
    # obj-m += rms/trs_drv/cdqm/host/
    obj-m += rms/trs_drv/shr_id/
    obj-m += rms/trs_drv/trs_stars/stars_v1/near/
    # end
else
    KERNEL_UNAME := $(shell uname -r)
    PWD := $(shell pwd)

    DAVINCI_HIAI_DKMS := y
    HIAI_DKMS_DIR := $(shell pwd)

    export DAVINCI_HIAI_DKMS
    export HIAI_DKMS_DIR

    DKMS_JOBS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null)
    ifeq ($(strip $(DKMS_JOBS)),$(filter $(DKMS_JOBS), 0))
        DKMS_JOBS := 1
    else
        DKMS_JOBS := $(shell expr $(DKMS_JOBS) / 2)
    endif

all:
	$(MAKE) --jobs=$(DKMS_JOBS) -C /lib/modules/$(KERNEL_UNAME)/build M=$(PWD) modules

clean:
	$(MAKE) --jobs=$(DKMS_JOBS) -C /lib/modules/$(KERNEL_UNAME)/build M=$(PWD) clean

endif
